package cn.yangliu.model;

import cn.yangliu.constant.CallbackFunction;
import cn.yangliu.constant.ResultCode;

/**
 * the type of ascii_v3_ascii_acf_new
 *
 * <p>
 * .
 *
 * @author 汪新展
 * @date 2023-02-06
 */
public class CallbackParams<T> extends Result<T> {

    private String functionName;

    public CallbackParams() {
        super(ResultCode.SUCCESS);
    }


    public CallbackParams(ResultCode result, CallbackFunction function) {
        super(result);
        this.functionName = function.getFunctionName();
    }

    public CallbackParams(ResultCode result, String message, CallbackFunction function) {
        super(result);
        setMsg(String.format(result.getMsg(), message));
        this.functionName = function.getFunctionName();
    }



    public CallbackParams(ResultCode result, T data, CallbackFunction function) {
        super(result);
        setData(data);
        this.functionName = function.getFunctionName();
    }

    public CallbackParams(T data, String message, CallbackFunction function) {
        this();
        setData(data);
        setMsg(message);
        this.functionName = function.getFunctionName();
    }

    public CallbackParams(T data, CallbackFunction function) {
        this();
        setData(data);
        this.functionName = function.getFunctionName();
    }


    public String getFunctionName() {
        return functionName;
    }

    public void setFunctionName(String functionName) {
        this.functionName = functionName;
    }
}
